<%@ page language="java" pageEncoding="ISO-8859-1" import="java.util.*"%>

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <head>
    <html:base />
    
    <title>publicfir.jsp</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="text/javascript">

function getpst(f)
      { 
        
         var x;
         v=f.apn.value;
      try
      {
          x=new XMLHttpRequest();
      }
     catch(e)
      {
          try
          {
             x=new ActiveXObject("Msxml2.XMLHTTP");
          }
          catch(e)
          {
                try
                 {
                    x=new ActiveXObject("Microsoft.XMLHTTP");
                  }
                  catch(e)
                 {
                   alert("Browser not supported");
                }
           }
     }
    
   
    x.open("get","/police/genpub.do?regpub=getpostalcode&PD="+v,true);
   
   
    x.send(null);
    x.onreadystatechange=f2;
    function f2()
    {
   
    	if(x.readyState==4)
    	{
    	
    		var   bb=x.responseText;
    		
    	if(bb.match("invalid pincode"))
    		  {
    		   
    		    document.getElementById("gsps").innerHTML="<font color=red>invalid pincode</font>"
    		   
    		   }
    		  else
    		  {
    		  document.getElementById("gsps").innerHTML="<font color=red></font>" 
    		 var  cc= bb.split("#");
    	      
    		  
    		 var psid=cc[0];
 
    		  
    		 var psna=cc[1];
    		 
    		//document.forms[0].sps.options[0].style.visibility=true;
    		document.forms[0].sps.options[0]=new Option(psna,psid)
    		 
    	}
    		 
  
    		
    	}
    	
    }
    						
  }

function fundis(f)
{

 if(f.id[0].checked!=0)
 {
  
     f.vn.disabled=false
     f.pn.disabled=true
     f.pn.value=""
     f.an.disabled=true
     f.an.value=""
 }
 if(f.id[1].checked!=0)
 {
    
     f.vn.disabled=true
     f.vn.value=""
      f.pn.disabled=false
      f.an.disabled=true
      f.an.value=""
 }
 if(f.id[2].checked!=0)
 {
    
    f.vn.disabled=true
    f.vn.value=""
      f.pn.disabled=true
      f.pn.value=""
      f.an.disabled=false
 }
   
}


/*
function checkblank(f)
{
  nm=f.nm.value
  hn=f.hn.value
  ln=f.ln.value
  ct=f.ct.value
  po=f.po.value
  dt=f.dt.value
  pc=f.pc.value
  //lnn=f.lnn.value
  chn=f.chn.value
  cln=f.cln.value
  cct=f.cct.value
  cpo=f.cpo.value
  cdt=f.cdt.value
  cpc=f.cpc.value
  //clnn=f.clnn.value
  
   id=f.id
   mn=f.mn.value
   ph=f.ph.value
  apn=f.apn.value
  
  sps=f.sps.value
  stf=f.stf.value
  
if((nm.length==0)||(hn.length==0)||(ln.length==0)||(ct.length==0)||(po.length==0)||(dt.length==0)||(pc.length==0)||(chn.length==0)||(cln.length==0)||(cct.length==0)|| ((id[0].checked==0) &&(id[1].checked==0)&&(id[2].checked==0)) ||(cpo.length==0)||(cdt.length==0)||(cpc.length==0)|| (mn.length==0)||(ph.length==0)||(apn.length==0)||(sps.match("select"))||(stf.match("select1")))
{
    alert("pls fill all d fields")
	
      if(nm.length==0)
      {
         document.getElementById("gnm").innerHTML="<font color=red>Enter your name</font>"
      }
      
      if(hn.length==0)
      {
         document.getElementById("ghn").innerHTML="<font color=red>Enter house number</font>"
      }
      if(ln.length==0)
      {
         document.getElementById("gln").innerHTML="<font color=red>Enter lane</font>"
      }
      
      if(ct.length==0)
      {
         document.getElementById("gct").innerHTML="<font color=red>Enter city</font>"
      }
      if(po.length==0)
      {
         document.getElementById("gpo").innerHTML="<font color=red>Enter Post office</font>"
      }
      
      if(dt.length==0)
      {
         document.getElementById("gdt").innerHTML="<font color=red>Enter district</font>"
      }
      if(pc.length==0)
      {
         document.getElementById("gpc").innerHTML="<font color=red>Enter PIN code</font>"
      }
      
     
      if(chn.length==0)
      {
         document.getElementById("gchn").innerHTML="<font color=red>Enter house number</font>"
      }
      
      if(cln.length==0)
      {
         document.getElementById("gcln").innerHTML="<font color=red>Enter lane</font>"
      }
      if(cct.length==0)
      {
         document.getElementById("gcct").innerHTML="<font color=red>Enter city</font>"
      }
      
      if(cpo.length==0)
      {
         document.getElementById("gcpo").innerHTML="<font color=red>Enter Post office</font>"
      }
      if(cdt.length==0)
      {
         document.getElementById("gcdt").innerHTML="<font color=red>Enter district</font>"
      }
      
      if(cpc.length==0)
      {
         document.getElementById("gcpc").innerHTML="<font color=red>Enter PIN code</font>"
      }
      
       if(ph.length==0)
      {
         document.getElementById("gph").innerHTML="<font color=red>Enter district</font>"
       }
         if(mn.length==0)
      {
         document.getElementById("gmn").innerHTML="<font color=red>Enter mobile number</font>"
       }
       
      
      if(apn.length==0)
      {
         document.getElementById("gapn").innerHTML="<font color=red>Enter PIN code</font>"
      }
      
      if((id[0].checked==0)&&(id[1].checked==0)&&(id[2].checked==0))
      			{
         			document.getElementById("gid").innerHTML="<font color=red>Enter ID details</font>"
      			}
     
          
       if(sps.match("select"))
      {
         document.getElementById("gsps").innerHTML="<font color=red>Invalid PIN code</font>"
      }
      if(stf.match("select1"))
      {
         document.getElementById("gstf").innerHTML="<font color=red>Enter type of FIR</font>"
      } 
       return false;
   } 
   else
   {
   		 if((mn.length < 10) || (mn.length > 10))
         {
            alert("Invalid contact number")
            document.getElementById("gmn").innerHTML="<font color=red>invalid num</font>"
            
          }
          return false
   } 
            
}*/

function myonlynum()
{
    if((event.keyCode<48)||(event.keyCode>57))
    {
      alert("enter numeric values")
      event.returnValue=false
    }
}
</script>
<script language="javascript" type="text/javascript" src="datetimepicker_css.js"></script>
  <link href="css/style1.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="pink">
<div class="main-out">
<div class="main">
<div class="page">
<div class="top">
<div class="header">
<div class="header-top">
<%@include file="TopHead.jsp" %>
</div>
<div class="topmenu">
<%@include file="TopMenu.jsp" %>
</div>
<div class="">
<img src="images/d3.gif">
</div>
</div>
<div class="content">
<div class="content-left">
<div class="row1">
<div class="img">&nbsp;</div>
<div class="welcome">
<h1 class="title">Welcome to POlice Sewa<span></span></h1>
<p>




</p>

<%
 Object ob1=request.getAttribute("msg");
 if(ob1!=null)
 {
 %>
 <p><%=ob1.toString() %></p>
 <%
 }
  %> 
  
  <html:form action="genpub" onsubmit="return checkblank(this)">
  
    <table border="0" width="100%">
    <%
  Object ob=request.getAttribute("GP");
  
    ArrayList did=(ArrayList)request.getAttribute("PID");
   ArrayList dn=(ArrayList)request.getAttribute("PNAME");
   
   if(ob!=null)
   {
   %>
  
    <tr><td><fieldset style="padding: 2;width:1168px;">
    <legend> </legend>
    
         <table><tr>
			<td width="50">Name</td>
			<td><html:text property="nm"> </html:text> </td> 
			<td><label id="gnm"></label></td></tr>
			</table>
	   </fieldset>
		
 
	<tr>
	
	<td>

	<fieldset style="padding: 2; width:1168px; height:148px">
	<legend>Permanent Address Details</legend>
	<div align="left">
		<table border="0" width="60%">
			
			<tr>
				<td width="134">House Number</td>
				<td><html:text property="hn"></html:text></td>
				<td><label id="ghn"></label><br></td>
			</tr>
			<tr>
				<td width="134">Lane </td>
				<td><html:text property="ln"></html:text></td>
				<td><label id="gln"></label><br></td>
			</tr>
			<tr>
				<td width="134">City</td>
				<td><html:text property="ct"></html:text></td>
				<td><label id="gct"></label><br></td>
			</tr>
			<tr>
				<td width="134">Post Office</td>
				<td><html:text property="po"></html:text></td>
				<td><label id="gpo"></label><br></td>
			</tr>
			<tr>
				<td width="134">District</td>
				<td><html:text property="dt"></html:text></td>
				<td><label id="gdt"></label><br></td>
			</tr>
			<tr>
				<td width="134">Pin Code</td>
				<td><html:text property="pc"></html:text></td>
				<td><label id="gpc"></label><br></td>
			</tr>
			<tr>
				<td width="134">Landline Number</td>
				<td><html:text property="lnn"></html:text></td>
				
			</tr>
		</table>
	</div>
	</fieldset></td>
	</tr>
	<tr>
		<td>

		<fieldset style="padding: 2; width:1168px; height:211px">
		<legend>Correspondence Address</legend>
		<table border="0" width="60%">
			<tr>
				<td width="164">House Number</td>
				<td><html:text property="chn"></html:text></td>
				<td><label id="gchn"></label><br></td>
			</tr>
			<tr>
				<td width="164">Lane </td>
				<td><html:text property="cln"></html:text></td>
				<td><label id="gcln"></label><br></td>
			</tr>
			<tr>
				<td width="164">City</td>
				<td><html:text property="cct"></html:text></td>
				<td><label id="gcct"></label><br></td>
			</tr>
			<tr>
				<td width="164">Post Office</td>
				<td><html:text property="cpo"></html:text></td>
				<td><label id="gcpo"></label><br></td>
			</tr>
			<tr>
				<td width="164">District</td>
				<td><html:text property="cdt"></html:text></td>
				<td><label id="gcdt"></label><br></td>
			</tr>
			<tr>
				<td width="164">Pin Code</td>
				<td><html:text property="cpc"></html:text></td>
				<td><label id="gcpc"></label><br></td>
			</tr>
			<tr>
				<td width="164">Landline Number</td>
				<td><html:text property="clnn" onkeypress="myonlynum()"></html:text></td>
				
			</tr>
		</table>
	</fieldset></td>
	</tr>
	<tr>
		<td>
		<fieldset style="padding: 2; width:1168px; height:123px">
		<legend>Identity Details</legend>
		
		
		<div align="left">
			<table border="1" width="60%">
				<tr>
					<td><html:radio property="id" value="Voter Identification Number" onclick="fundis(this.form)">Voter Identification Number</html:radio></td>
					<td><html:text property="vn" disabled="true"></html:text> </td>
					<td><label id="gvn"></label> </td>
				</tr>
				<tr>
					<td><html:radio property="id" value="PAN Card Number" onclick="fundis(this.form)">PAN Card Number</html:radio></td>
					<td><html:text property="pn" disabled="true"></html:text> </td>
					<td><label id="gpn"></label> </td>
				</tr>
				<tr>
					<td><html:radio property="id" value="ADHAR Card Number" onclick="fundis(this.form)">ADHAR Card Number</html:radio></td>
					<td><html:text property="an" disabled="true"></html:text> </td>
					<td><label id="gan"></label> </td>
				</tr>
				<tr>
				<td><label id="gid"></label></td>
				</tr>
				
			</table>
		</div>
		
		
		
		
		
		</fieldset></td>
	</tr>
	<tr>
		<td>
		<fieldset style="padding: 2; width:1168px; height:123px">
		<legend>FIR Details</legend>
		<div align="left">
			<table border="0" width="60%">
				<tr>
					<td width="148">Mobile Number</td>
					<td><html:text property="mn" onkeypress="myonlynum()"></html:text></td>
					<td><label id="gmn"></label><br></td>
				</tr>
				<tr>
					<td width="148">Photo</td>
					<td><html:file property="ph"></html:file> </td>
					<td><label id="gph"></label><br></td>
				</tr>
				
				
				<tr>
					<td width="148">Incident date</td>
					<td width="76%">
<input type="text" name="T2" id="demo3" size="20" readonly="readonly" onfocus="javascript:NewCssCal('demo3','ddMMMyyyy','arrow')">
</td> 
					<td><label id="gind"></label><br></td>
				</tr>
				
				<tr>
					<td width="148">Incident Area PIN code</td>
					<td><html:text property="apn"></html:text></td> 
					<td><label id="gapn"></label><br></td>
				</tr>
				<tr>
					<td width="148"><html:button onclick="getpst(this.form)" value="Get Police Station" property="bb"/></td>
					<td><html:select property="sps" style="visibility:true">
					
					</html:select> </td>
					<td><label id="gsps"></label><br></td>
				</tr>
				<tr>
					<td width="148">Type Of FIR</td>
					<td><html:select property="stf">
					<html:option value="Select">Select Type of FIR</html:option>
					<%if(did!=null)
					{ 
		    	         for(int i=0;i<did.size();i++)
		    	         {
		    	  
		    	         %>
		    	 
					
					             <html:option value="<%=did.get(i).toString() %>"><%=dn.get(i).toString() %></html:option>
					
				         <% 	}}%>
					
					</html:select></td>
					<td><label id="gstf"></label><br></td>
				</tr>
				
				
			</table>
		</div>
		</fieldset></td>
	</tr>
	<tr>
			<td>&nbsp;</td>
		</tr>				
	
	<tr>
		<td align="center"><html:submit value="Register" property="regpub"> </html:submit> </td>
	</tr>
				
	<%} %>
	
</table>
</html:form>


</div>
</div>

</div>
<div class="content-right">
<%@include file="SideMenu.jsp" %>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
</div>
</div>
<div class="bottom">
<!--DO NOT Remove The Footer Links-->
<p><%@include file="Footer.jsp"  %><br>
<!--DO NOT Remove The Footer Links-->
</p>
</div>
</div>
</div>
</div>
</body>
</html:html>
